package Logic.EventSample.Scene;

import FrameWork.Event.TriggerManager;
import FrameWork.Model.Player;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SceneService {

    //使用@Autowired注入我们之前定义的触发器
    @Autowired
    private EnterSceneTrigger enterSceneTrigger;

    public void enterScene(Player player,int fromSceneId,int toSceneId){
        //触发方法1
        enterSceneTrigger.fire(fromSceneId,player);
        //触发方法2
        TriggerManager.getTrigger(EnterSceneTrigger.class).fire(fromSceneId,player);
    }

}
